﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>DiXon - JavaScript Client Pages - Integration</title>
    <link rel="Stylesheet" href="Stylesheet.css" />
    <link rel="Stylesheet" href="Simple.css" />
    <link rel="Contents" href="index.html" />
</head>
<body>
    <div id="header">
        <span class="technology">JavaScript Client Pages </span><span class="title">Developer's
            Manual </span><span class="sub-title">Development </span>
    </div>
    <div id="body">
        <h1>
            Integration Basics</h1>
        <h2>
            How DiXon Works</h2>
        <p>
            The DiXon compiler parses XHTML pages enhanced with <a href="Development.html#heading-embedded-javascript-code">
                embedded code</a> and custom <a href="Development.html#heading-xml-based-markup">XML-based
                    markup elements</a> providing client-side presentation logic. The compiler
            itself is written in XSLT 1.0, but because there is no standard way to perform XSLT
            transformations from JavaScript code, and some popular browsers either have limited
            support for this capability or no support at all, the DiXon compiler needs to run
            on the server. In addition to addressing compatibility issues, this approach improves
            performance by reducing back-and-forth traffic and by storing compiled pages on
            the server's hard drive and serving them verbatim until the page is modified.
        </p>
        <h2>
            Loading JavaScript Client Pages</h2>
        <p>
            The <dfn>host application</dfn> is the Web application or a collection of static
            pages that uses JavaScript Client Pages to display some of its content ot to respond
            to certain user actions.
        </p>
        <h3>
            Prerequisites</h3>
        <p>
            Before a JavaScript client page can be used from a Web page in the host application,
            the following requirements need to be met:
        </p>
        <ol>
            <li>DiXon should be available to the Web application</li>
            <li>The page should have requested the page from DiXon</li>
            <li>DiXon should be able to successfully compile the page.</li>
        </ol>
        <p>
            Before you begin using JavaScript Client Pages, you will need to give your Web application
            to DiXon. In order to do so, you will need to copy the contents of the DiXon distribution
            for your platform to your application's Web root.
        </p>
        <p>
            If you have access to one of the platforms for which DiXon has been released, but
            your application runs on a different platform, you will sill be able to use it.
            However, you will then need to install it separately and then make your Web pages
            point to your DiXon installation when requesting pages.
        </p>
        <h3>
            Including the JSClientPages library</h3>
        <p>
            The code generated by DiXon uses some functionality that is not readily available
            in browsers. All this functionality is implemented in standards-based ECMAScript
            / JavaScript code with minimal use of non-standard features only for non-essential
            functionality (e.g. debugging stack traces) and bundled in a JavaScript library
            called
            <samp>
                JSClientPages.js</samp>To include this library, insert the following code in
            the
            <samp>
                &lt;head&gt;</samp>
            your Web pages:
        </p>
        <div class="code">
            &lt;html&gt;
            <div class="indent">
                &lt;head&gt;
                <div class="indent">
                    <div class="code-block">
                        &lt;title&gt;My Web Application&lt;/title&gt;
                    </div>
                    <div class="highlight">
                        &lt;script src="JSClientPages.js" type="text/javascript"&gt;&lt;/script&gt;
                    </div>
                </div>
                &lt;/head&gt;
                <br />
                &lt;body&gt;
                <div class="indent">
                    &lt;!-- My Web Application's content --&gt;
                </div>
                &lt;/body&gt;
            </div>
            &lt;/html&gt;
        </div>
        <p class="warning">
            <span class="warning">Warning:</span>Make sure that the above
            <samp>
                script</samp>
            tag is <span class="emphasis">not a broken link.</span> If you installed DiXon in
            a directory other than your Web root, you should adjust the path accordingly. Also,
            adjustments might need to be made for applications that rely on URL rewriting to
            map client requests to a single dispatcher, such as Ruby on Rails, the Zend Framework,
            CakePHP and other "push-MVC" frameworks with a similar architecture.
        </p>
        <h4>
            Where Did <span class="keyword">language="JavaScript"</span> Go?</h4>
        <p>
            In modern Web standards, the
            <samp>
                language</samp>
            attribute is neither required nor considered valid, since browsers can determine
            the language being used from the content type defined in the
            <samp>
                type</samp>
            attribute. However, many Web developers still include it because "old habits die
            hard". Due to the forgiveness of most Web browsers, its inclusion is unlikely to
            break anything except for validation.
        </p>
        <p>
            This manual focuses on recent Web standards supported in "6th-generation" and newer
            browsers.
        </p>
        <p>
            If you would like to continue using obsolete attributes and elements, you can feel
            free to do so, but they are beyond the scope of this manual and, thertore, they
            will not be used in examples regardless of how common they are in practice.
        </p>
        <h3>
            Requesting Pages from the Compiler</h3>
        <p>
            By default, JavaScript Client pages reside in the
            <samp>
                jscp</samp>
            directory in your document root. For a page called
            <samp>
                ClientPage.xml</samp>
            residing in
            <samp>
                <span class="placeholder">[web root]</span>/jscp/ClientPage.xml</samp>, the
            following
            <samp>
                script</samp>
            tag needs to be added:
        </p>
        <div class="code">
            &lt;html&gt;
            <div class="indent">
                &lt;head&gt;
                <div class="indent">
                    <div class="code-block">
                        &lt;title&gt;My Web Application&lt;/title&gt;
                    </div>
                    &lt;script src="JSClientPages.js" type="text/javascript"&gt;&lt;/script&gt;<br />
                    <span class="highlight">&lt;script src="JSClientPage.ashx?page1=ClientPage.xml" type="text/javascript"&gt;&lt;/script&gt;</span>
                </div>
                &lt;/head&gt;
                <br />
                &lt;body&gt;
                <div class="indent">
                    &lt;!-- My Web Application's content --&gt;
                </div>
                &lt;/body&gt;
            </div>
            &lt;/html&gt;
        </div>
        <h3>
            Loading Multiple Pages</h3>
        <p>
            The DiXon compiler has the ability to load multiple JavaScript Client Pages in a
            single HTTP request. Therefore, if your Web page uses two or more JavaScript Client
            Pages for its dynamic content, it should include them all at the same time regardless
            of whether they are always invoked by the page in question.
        </p>
        <p>
            The general template for a multi-page DiXon request is as follows:
        </p>
        <code>&lt;script src="JScriptClientPage.ashx?page1=Page1.xml&page2=Page2.xml&...&page<span
            class="emphasis">n</span>=PageN.xml&gt;&lt;/script&gt; </code>
        <p>
            Where <span class="keyword">n</span> is the number of the page wiithin the request.
        </p>
        <h3>
            Platform Adjustments</h3>
        <p>
            <samp>
                JSClientPages.ashx</samp>
            is the name of the DiXon invoker for the .NET platform, which was the first platform
            binding developed for the DiXon-JSClientPages project and is therefore considered
            to be its <span class="emphasis">reference implementation</span>.
        </p>
        <p>
            Given below is the name of the DiXon invoker for each platform supported at the
            time of writing:
        </p>
        <table>
            <thead>
                <tr>
                    <th>
                        Platform
                    </th>
                    <th>
                        Flavor
                    </th>
                    <th>
                        Invoker Name
                    </th>
                    <th>
                        Notes
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        .NET
                    </td>
                    <td>
                        Microsoft
                    </td>
                    <td>
                        JSClientPage.ashx
                    </td>
                    <td rowspan="2">
                        Both implementations use the same code base. Since the Mono implementation tends
                        to be a few releases behind the one from Microsoft, you should ensure that you are
                        using an up-to-date version of Mono.
                    </td>
                </tr>
                <tr>
                    <td>
                        .NET
                    </td>
                    <td>
                        Mono
                    </td>
                    <td>
                        JSClientPage.ashx
                    </td>
                </tr>
                <tr>
                    <td>
                        PHP
                    </td>
                    <td>
                        <a href="http://www.php.com">The PHP Group</a>
                    </td>
                    <td>
                        JSClientPage.php
                    </td>
                    <td>
                        For PHP applications running on UNIX-like platforms, it is <span class="emphasis">recommended</span>
                        to use the PHP implementation.
                        <br />
                        For "WIMP" systems (PHP on Windows + IIS), the .NET version could be used as well.
                        Systems that use CGI to invoke PHP might obtain better performance if the .NET implementation
                        is used regardless of the platform on which the host application is running.
                    </td>
                </tr>
                <tr>
                    <td>
                        PHP
                    </td>
                    <td>
                        <a href="http://www.php-compiler.net">Phalanger</a>
                    </td>
                    <td>
                        JSClientPage.php
                        <br />
                        <span class="emphasis">or</span>
                        <br />
                        JSClientPage.ashx
                    </td>
                    <td>
                        Unlike the official implementation of the PHP language, Phalanger integrates into
                        the .NET framework and supports both Microsoft .NET and Mono. Therefore, the .NET
                        handler can be used with Phalanger.
                    </td>
                </tr>
            </tbody>
        </table>
        <h1>
            Invoking Pages from Target Code</h1>
        <h2>
            Where to Invoke JavaScript Client Pages</h2>
        <p>
            Normally, JavaScript Client Pages are invoked from within event handlers in client-side
            code that respond to user-triggered events such as:
        </p>
        <ul>
            <li>Submitting a form</li>
            <li>Clicking on a link</li>
            <li>Pressing a button</li>
            <li>Making a selection in a menu</li>
            <li>Drag&Drop operations</li>
            <li>Changing the value in a form element</li>
            <li>Selecting an item</li>
        </ul>
        <h2>
            Choosing a Target</h2>
        <p>
            Although a JavaScript Client Page might have a semantic resemblance to a complete
            XHTML page, in most cases, only a portion of a page appearing in the user's browser
            at a given time actually needs to be refreshed. In fact, like with most AJAX-type
            technologies, complete page reloads are very uncommon with DiXon-JSCP.
        </p>
        <p>
            The
            <samp>
                target</samp>
            refers to an element within an XHTML document's Document Object Model (DOM) to which
            DiXon-generated content will be added. Although any element can theoretically be
            used as a
            <samp>
                target</samp>, most applications will use a block-level element, such as a
            <samp>
                &lt;div&gt;</samp>
        </p>
        <h2>
            Naming the JavaScript Client Page</h2>
        <p>
            The name of the JavaScript Client Page used in invocations from client scripts is
            completely independent from its file system name, which makes it possible to have
            several versions of the same page with similar logic but different presentation
            styles.
        </p>
        <p>
            The name of each page is defined in the
            <samp>
                &lt;head&gt;</samp>
            section. by means of an XHTML
            <samp>
                &lt;meta&gt;</samp>
            tag named
            <samp>
                JSClientPage</samp>.
        </p>
        <p>
            Given below is a sample page name declaration:
        </p>
        <div class="code">
            &lt;html&gt;
            <div class="indent">
                &lt;head&gt;
                <div class="indent">
                    &lt;title&gt;JSCP - Message Page&lt;/title&gt;
                    <br />
                    <span class="highlight">&lt;meta name="JSClientPage" Content="Message" /&gt;</span>
                </div>
                &lt;/head&gt;
                <br />
                &lt;body&gt;
                <div class="indent">
                    &lt;div class="message"&gt;
                    <div class="indent">
                        &lt;h1&gt;<span class="keyword">&lt;js:output value="input.subject" /&gt;</span>&lt;/h1&gt;
                        <br />
                        &lt;div class="body"&gt;
                        <div class="indent">
                            <span class="keyword">&lt;js:output value="input.body" /&gt;</span>
                        </div>
                        &lt;/div&gt;
                    </div>
                    &lt;/div&gt;
                </div>
                &lt;/body&gt;
            </div>
            &lt;/html&gt;
        </div>
        <h2 id="header-rendering">
            Rendering a Page</h2>
        <p>
            <samp>
                Rendering</samp>
            a JavaScript Client Page refers to the process of displaying some content using
            the presentation logic contained in a JavaScript Client Page in a target element.
        </p>
        <h3 id="header-rendering-additive">
            Additive Rendering</h3>
        <p>
            The static
            <samp>
                render</samp>
            method of the JSClientPages method renders the JavaScript Page specified by the
            invoker in the target element by appending any elements emitted by the page as new
            child elements without removing any existing elements. Thus, if the selected target
            already contains elements, they will not be removed, modified or otherwise "touched".
        </p>
        <h4>
            Common Scenarios:</h4>
        <ul>
            <li>Adding rows to a table body</li>
            <li>Adding repeating content items to a content box:
                <ul>
                    <li>News articles</li>
                    <li>Posts on a blog or a message board</li>
                    <li>Recipes</li>
                    <li>Similar information for different locations, such as weather forecasts</li>
                </ul>
            </li>
            <li>Dynamically configuring the user's page on a portal</li>
        </ul>
        <h4>
            Rendering a Page</h4>
        <p>
            Consider the following HTML page:
        </p>
        <div class="code">
            &lt;html&gt;
            <div class="indent">
                &lt;head&gt;
                <div class="indent">
                    &lt;title&gt;My Messages&lt;/title&gt;<br />
                    &lt;script type="text/javascript" src="JSClientPages.js"&gt;&lt;/script&gt; &lt;script
                    type="text/javascript" src="JSClientPages.ashx?page1=Message.xml"&gt;&lt;/script&gt;
                </div>
                &lt;/head&gt;<br />
                &lt;body&gt;
                <div class="indent">
                    &lt;h1&gt;My Messages&lt;/h1&gt;<br />
                    &lt;h2&gt;Add a Message&lt;/h2&gt;
                    <div class="indent">
                        &lt;form id="message-form" onsubmit=&quot;Message.submit(); return false;&quot;
                        action="SubmitMessage.ashx"&gt;
                        <div class="indent">
                            &lt;h3&gt;Subject&lt;/h3&gt;
                            <br />
                            &lt;input id="message-form-subject" type="text" name="subject" width="30" /&gt;
                            <br />
                            &lt;h3&gt;Body&lt;/h3&gt;<br />
                            &lt;textarea id="message-form-body" rows="5" cols="50"&gt;&lt;/textarea&gt;<br />
                            &lt;div class="button-panel"&gt;
                            <div class="indent">
                                &lt;input type="submit" name="submit" value="Post" /&gt;
                                <br />
                                &lt;input type="reset" name="reset" value="Reset" /&gt;
                            </div>
                            &lt;/div&gt;
                        </div>
                        &lt;/form&gt;
                    </div>
                    &lt;h2&gt;Your Posted Messages&lt;/h2&gt;
                    <br />
                    <span class="highlight">&lt;div id="posted-messages"&gt&lt;/div&gt;</span>
                </div>
                &lt;/body&gt;
            </div>
            &lt;/html&gt;
        </div>
        <p>
            This page was designed to enable the user to post a simple message using an asynchronous
            AJAX request. When the form is submitted, instead of
            <samp>
                POST</samp>ing its contents directly to a server-side handler, the browser will
            invoke a script function named <code>Message.submit()</code>, which will issue the
            AJAX request and register a handler that will render the page when the response
            comes back.
        </p>
        <p>
            The highlighted <code>&lt;div&gt;</code> tag is just a container to which messages
            will be added dynamically using JavaScript Client Pages code. It is referred ro
            as a <span class="emphasis">rendering target</span>.
        </p>
        <p>
            Given below is a code example showing how a JavaScript Client Page will be rendered,
            and the final contents will then be added to the <code>posted-messages</code> element.
        </p>
        <div class="code">
            Message =
            <br />
            {
            <div class="indent">
                <div class="code-block">
                    submit : <span class="keyword">function</span>()
                    <div class="code-block">
                        {
                        <div class="indent">
                            <span class="keyword">var</span> message =
                            <div class="code-block">
                                {
                                <div class="indent">
                                    subject: document.getElementById('message-form-subject').value,
                                    <br />
                                    body: document.getElementById('message-form-body').value
                                </div>
                                };
                            </div>
                            this.send(message);
                        </div>
                        },
                        <div class="code-block">
                            send : <span class="keyword">function</span>(message) {
                            <div class="indent">
                                <span class="keyword">var</span> request = <span class="keyword">new</span> XMLHttpRequest();
                                <br />
                                <br />
                                <span class="keyword">var</span> form = document.getElementById('message-form');
                                <br />
                                <br />
                                <span class="keyword">var</span> url = form.action; request.onreadystatechange =
                                function(transport) {
                                <div class="indent">
                                    <span class="keyword">if</span> (request.readystate == 4) {
                                    <div class="indent">
                                        <span class="keyword">var</span> messageElement =
                                        <br />
                                        <div class="indent">
                                            transport.responseXml.getElementsByTagName('message')[0];
                                        </div>
                                        <span class="keyword">var </span>message = {
                                        <div class="indent">
                                            subject: messageElement.getElementsByTagName('subject')[0].data,
                                            <br />
                                            body: messageElement.getElementsByTagName('body')[0].data
                                        </div>
                                        };
                                        <br />
                                        Message.render(message);
                                    </div>
                                    }
                                </div>
                                };
                            </div>
                            },
                        </div>
                        <div class="code-block">
                            render : <span class="keyword">function</span>(message) {
                            <div class="indent highlight" style="width: 15em">
                                JSClientPage.render(
                                <div class="indent">
                                    'Message',
                                    <br />
                                    'posted-messages',
                                    <br />
                                    message
                                </div>
                                );
                            </div>
                        </div>
                        }
                    </div>
                </div>
            </div>
            }
        </div>
        <p class="warning">
            <span class="warning">Warning:</span> The above example was coded to a very recent
            standard and, therefore, requires IE7 and above, a Gecko browser, Safari 2.x and
            above or any other browser that exposes the XMLHttpRequest object in the global
            namespace (i.e. as a property of the <code>window</code>). Earlier versions of Internet
            Explorer will require an explicit ActiveX instantiation of that object, which is
            usually provided as a fall-back option in popular JavaScript frameworks and toolkits,
            such as <a href="http://www.prototypejs.org/">Prototype</a> and <a href="#">YUI</a>.
        </p>
        <p>
            If a user submits multiple messages using the message form, all the messages will
            appear in the <code>posted-messages</code> container one after another.
        </p>
        <h3 id="header-rendering-replacement">
            Replacement Rendering (a.k.a. Refreshing)</h3>
        <p>
            Replacement rendering uses the same logic and semantics as <a href="#header-rendering-additive">
                additive rendering</a>, except that the contents of the rendering target are
            <span class="emphasis">removed from the document</span> before the page is render.
            In order to replace any existing content, the <code>JSClientPages</code> library
            will call the <code>removeChild()</code> method on the rendering target for all
            of its child notes and then render the page in an empty target element.
        </p>
        <p>
            Given below is a list of scenarios where replacement rendering is useful:
        </p>
        <ul>
            <li>Recalculating totals in a shopping cart</li>
            <li>Showing the results of a calculation for the values entered by the user (e.g. in
                a BMI calculator)</li>
            <li>Displaying a preview for a Web page generated from user input using a template</li>
            <li>Displaying the result of a query processed on the server</li>
            <li>Refreshing a complex layout where, despite the fact that items are being added rather
                than replaced, every added item has side effects on various parts of the layout.
            </li>
        </ul>
        <h4>
            Refreshing Containers</h4>
        <p>
            Replacement rendering is invoked the same way as <a href="#header-additive-rendering">
                additive rendering</a> except that <code>JSClientPage.render</code> needs to
            be replaced with <code>JSClientPage.refresh</code>.
        </p>
        <h1>
            Best Practices</h1>
        <h2>
            Client-Side</h2>
        <dl>
            <dt>Consolidate Script Requests</dt>
            <dd>
                Instead of writing a <code>script</code> element for every page you are planning
                to include, create one <code>script</code> element for all pages on which your page
                depends.
                <div class="code">
                    <del>&lt;script type="text/javascript src="JSClientPage.ashx?page=Employees.xml"&gt;&lt;script&gt;</del><br />
                    <del>&lt;script type="text/javascript src="JSClientPage.ashx?page=Resumes.xml"&gt;&lt;script&gt;</del>
                    <br />
                    <ins>&lt;script type="text/javascript src="JSClientPage.ashx?page1=Employees.xml<span
                        class="highlight">&amp;page2=Resumes.xml</span>"&gt;&lt;script&gt;</ins>
                </div>
            </dd>
            <dt>Don't Write Your Main Page in JSCP</dt>
            <dd>
                DiXon-JSClientPages is a lightweight client-side technology that was designed to
                render page fragments for information that is either created directly in client-side
                code or by means of an AJAX request. In most browsers, DOM manipulation takes longer
                than parsing, and while this difference is negligible for a fragment, it might take
                a considerable amount of time to render a page with a few megabytes of content using
                DOM manipulation. Furthermore, JavaScript Client Pages does not provide any of the
                productivity and security features found in advanced Web development frameworks.
            </dd>
            <dt>Do Not Use <code>document.write()</code></dt>
            <dd>
                <h4>Reasons:</h4>
                <ol>
                    <li>
                        In many browsers, if the page is served as <samp>application/xml</samp> or <samp>application/xhtml+xml</samp>,
                        <code>document.write()</code> will <span class="emphasis">overwrite the entire page</span> instend of appending to the
                        current context. This is because the page is not guaranteed to stay well-formed after its use.
                    
                    </li>
                    <li><code>document.write()</code> will <span class="warning">not respect the rendering
                        target</span>, but in some cases, it might work (somewhat) correctly if the code
                        that calls the page happens to be located in the rendering target itself. </li>
                </ol>
                <h4>
                    Alternatives (in decreasing order of preference)</h4>
                <ol>
                    <li>Text and markup with elements from the <code>js</code> namespace</li>
                    <li>DOM Assembly Functions
                        <ul>
                            <li><code>startElement()</code></li>
                            <li><code>endElement()</code></li>
                            <li><code>attribute()</code></li>
                            <li><code>text()</code></li>
                        </ul>
                    </li>
                    <li>The <code>raw()</code> function</li>
                </ol>
                <p class="warning">
                    <span class="warning">Warning:</span> the <code>raw()</code> function makes it possible
                    to programmatically insert raw HTML into a page by creating an empty element and
                    adding custom HTML to it using its <code>innerHTML</code> property.
                </p>
                <p class="warning">
                    Because of its popularity, this element is available in all major browsers. However,
                    it is <span class="emphasis">not part of any final W3C recommendation.</span>
                </p>
            </dd>
            <dt>Do Not Refresh the Whole Page</dt>
            <dd>
                While it is acceptable to refresh a small fragment of a page, such as a news feed
                or a list of items, re-rendering massive amounts of content can cause performance
                problems on some systems.
            </dd>
            <dt>Keep the Bulk of JavaScript Code in Separate Files</dt>
            <dd>
                Not only do large amounts of inline JavaScript difficult to understand, but they
                also cause problems with special characters if the page is served as
                <samp>
                    text/html</samp>
                or is otherwise interpreted by a multipurpose HTML engine that uses a traditional
                ("tag soup") parser rather than requiring strict XML compliance. Consider the following
                examples:
                <h4>
                    Invalid XHTML</h4>
                <div class="code">
                    &lt;script type="text/javascript"&gt;
                    <div class="indent">
                        <span class="keyword">for</span> (<span class="keyword">var</span> i = 0; i <span
                            class="highlight">&lt;</span> items.count ; i++) { // Invalid because an angle
                        bracket signals the beginning of an element
                        <div class="indent">
                            process(items[i]);
                        </div>
                        }
                    </div>
                    &lt;/script&gt;
                </div>
                <h4>
                    Invalid JavaScript</h4>
                <div class="code">
                    &lt;script type="text/javascript"&gt;
                    <div class="indent">
                        <span class="keyword">for</span> (<span class="keyword">var</span> i = 0; i <span
                            class="highlight">&amp;lt;</span> items.count ; i++) { // The JavaScript engine
                        interprets this as "&amp;lt;" instead of "&lt;"
                        <div class="indent">
                            process(items[i]);
                        </div>
                        }
                    </div>
                    &lt;/script&gt;
                </div>
                <h4>
                    Valid But Uncommon JavaScript and XHTML</h4>
                <p>
                    While wrapping the script in a CDATA section solves the problem of using characters
                    that have a special meaning in XML, XHTML and SGML, this technique is rather uncommon
                    and, therefore, might cause problems with some JavaScript frameworks like <a href="http://www.prototypejs.org/">
                        Prototype</a>
                </p>
                <div class="code">
                    &lt;script type="text/javascript"&gt;
                    <div class="indent">
                        <span class="highlight">//&lt;![CDATA[</span>
                        <div class="indent">
                            <span class="keyword">for</span> (<span class="keyword">var</span> i = 0; i &lt;
                            items.count ; i++) {
                            <div class="indent">
                                process(items[i]);
                            </div>
                            }
                        </div>
                        // <span class="highlight">]]&gt;</span>
                    </div>
                    &lt;/script&gt;
                </div>
            </dd>
        </dl>
        <h2>
            Server-Side</h2>
        <dl>
            <dt>Use What's Best For Your Platform</dt>
            <dd>
                <p>
                    Generally, ports of popular platforms to other systems where they do not have a
                    large user base are inferior to their original versions. For JSClientPages rendering,
                    Unix/Linux users developing PHP applications on Apache should prefer PHP over Mono.
                    Windows Server developing Web applications on the .NET framework should use the
                    .NET bindings even if PHP is available on the server.
                </p>
                <p>
                    Apart from platform stability, is should be noted that all platform bindings will be
                    tested on the platforms where they are used most frequently, and common issues and
                    gotchas will be addressed with solutions posted on 
                    <a href="http://www.codeplex.com/JSClientPages">the project page</a>. However,
                    unresolved issues may exist on uncommon platform configurations such as PHP on ISAPI
                    or various Unix ports of .NET running on Apache. However, full support for the 
                    <a href="http://www.go-mono.com/">Mono Project</a>'s implementation of the .NET
                    framework is one of the project goals.                
                </p>
            </dd>
            <dt>If it's Top Secret, Keep It On the Server</dt>
            <dd>
                <p>
                    Like any other scripting solution, all JavaScript code generated by DiXon is transferred 
                    to the client's machine and then interpreted by the browser's scripting engine. The integrity
                    of this process cannot be relied on, since various tools exist that allow even non-technical
                    users to manipulate Web pages directly in the browser. 
                </p>
                <p>
                    Common pitfalls include:
                </p>
                <ul>
                    <li>Trusting input from AJAX calls to leave all server-supplied data intact</li>
                    <li>Embedding authentication tokens in Web pages</li>
                    <li>
                        Generating server-side code from a client page and sending it to the server
                        for execution.
                    </li>
                    <li>
                        Exposing Web services or AJAX-callable routines that allow users to fetch 
                        arbitrary content from the database, including content that they are not
                        allowed to access.
                    </li>
                </ul>
            </dd>
        </dl>
    </div>
    <div id="footer">
        <p>
            <a href="http://validator.w3.org/check?uri=referer">
                <img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Strict"
                    height="31" width="88" /></a> <span class="copyright">DiXon-JSClientPages &copy; 2008
                        by Artem Ploujnikov. All Rights Reserved.</span>
        </p>
    </div>
</body>
</html>
